<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template name="debug_info">
		<xsl:param name="pass_info" select="pass_info"/>
		<div>
			<strong>Info</strong>
			<br/>
			<xsl:for-each select="$pass_info/info">
				<xsl:text>[</xsl:text>
				<xsl:value-of select="@name"/>
				<xsl:text>:</xsl:text>
				<xsl:value-of select="text()"/>
				<xsl:text>]</xsl:text>
				<br/>
			</xsl:for-each>
		</div>
	</xsl:template>
	<xsl:template name="debug_errors">
		<xsl:param name="pass_info" select="pass_info"/>
		<div>
			<strong>Errors</strong>
			<br/>
			<xsl:for-each select="$pass_info/error">
				<xsl:text>[</xsl:text>
				<xsl:value-of select="@name"/>
				<xsl:text>:</xsl:text>
				<xsl:value-of select="text()"/>
				<xsl:if test="@field_name">
					<xsl:text>:</xsl:text>
					<xsl:value-of select="@field_name"/>
				</xsl:if>
				<xsl:if test="@field_prefix">
					<xsl:text>:</xsl:text>
					<xsl:value-of select="@field_prefix"/>
				</xsl:if>
				<xsl:text>]</xsl:text>
				<br/>
			</xsl:for-each>
		</div>
	</xsl:template>
	<xsl:template name="debug_vars">
		<xsl:param name="pass_info" select="pass_info"/>
		<div>
			<strong onclick="document.getElementById('dvdvdv').style.display = document.getElementById('dvdvdv').style.display == 'block' ? 'none' : 'block'" style="border-bottom: 1px dotted black; cursor: pointer">Vars</strong>
			<xsl:text> (</xsl:text>
			<xsl:value-of select="count($pass_info/vars/var)" />
			<xsl:text>)</xsl:text>
			<br/>
			<div id="dvdvdv" style="display: none">
				<xsl:for-each select="$pass_info/vars/var">
					<xsl:text>[</xsl:text>
					<xsl:value-of select="@name"/>
					<xsl:text>:</xsl:text>
					<xsl:value-of select="text()"/>
					<xsl:text>]</xsl:text>
					<br/>
				</xsl:for-each>
			</div>
		</div>
	</xsl:template>
	<xsl:template name="debug">
		<xsl:param name="pass_info" select="pass_info"/>
		<xsl:call-template name="debug_info">
			<xsl:with-param name="pass_info" select="$pass_info" />
		</xsl:call-template>
		<xsl:call-template name="debug_errors">
			<xsl:with-param name="pass_info" select="$pass_info" />
		</xsl:call-template>
		<xsl:call-template name="debug_vars">
			<xsl:with-param name="pass_info" select="$pass_info" />
		</xsl:call-template>
	</xsl:template>
</xsl:stylesheet>
